"use strict";
cc._RF.push(module, '0289fKbX8ZG6K/QixOao29j', 'SimGuideView');
// scripts/SimGuideView.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GlobalUserData"),
    s = t("BroadCastMessage"),
    l = cc._decorator,
    c = l.ccclass,
    d = l.property,
    h = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.node_guide1 = null, e.node_guide2 = null, e.node_hand = null, e.guideHint = null, e.btn = null, e.bg = null, e;
  }

  return n(e, t), e.prototype.onLoad = function () {
    this.node_guide1.active = !1, this.node_guide2.setPosition(cc.Vec3.ZERO), this.node_hand.active = !1, this.guideHint.active = !1, this.btn.active = !1, s["default"].getInstance().RemoveMessage(this), s["default"].getInstance().RegisterMessage(this);
  }, e.prototype.onEnable = function () {
    null == r["default"].popup && (r["default"].popup = this.node);
  }, e.prototype.onDisable = function () {
    r["default"].popup === this.node && (r["default"].popup = null);
  }, e.prototype.start = function () {
    var t = this;
    this.scheduleOnce(function () {
      var e = t.node_hand.width / t.node_hand.height;
      t.node_hand.width = 150, t.node_hand.height = 150 / e;
    }, .1);
  }, e.prototype.onDestroy = function () {
    s["default"].getInstance().RemoveMessage(this);
  }, e.prototype.guide_click = function (t, e) {
    this.bg.getComponent(cc.Button).interactable = -1 !== e, this.node.active = !0, console.log("执行guide_click"), this.node_hand.stopAllActions(), this.node_guide1.active = !0, this.node_hand.active = !0;
    var o = t.convertToWorldSpaceAR(cc.Vec2.ZERO),
        i = this.node.convertToNodeSpaceAR(o);
    this.node_guide1.setPosition(i), this.node_hand.setPosition(i), this.node_guide1.setContentSize(t.getContentSize()), this.node_guide2.setPosition(cc.Vec3.ZERO), this.node_guide2.setContentSize(t.getContentSize()), this.handShake(i);
  }, e.prototype.guide_hint = function (t, e) {
    this.bg.getComponent(cc.Button).interactable = -1 !== e, this.node.active = !0, this.guideHint.active = !0, console.log("执行guide_hint"), this.node_guide1.active = !0, this.node_hand.active = !1;
    var o = t.convertToWorldSpaceAR(cc.Vec2.ZERO),
        i = this.node.convertToNodeSpaceAR(o);
    this.node_guide1.setPosition(i), this.node_hand.setPosition(i), this.node_guide1.setContentSize(t.getContentSize()), this.node_guide2.setPosition(cc.Vec3.ZERO), this.node_guide2.setContentSize(t.getContentSize());
  }, e.prototype.guide_move = function (t, e, o, i) {
    this.node.active = !0, this.node_guide1.active = !0, this.node_hand.active = !0;
    var n = t.convertToWorldSpaceAR(cc.Vec2.ZERO),
        a = this.node.convertToNodeSpaceAR(n);
    this.node_guide1.setPosition(a);
    var r = e.convertToWorldSpaceAR(cc.Vec2.ZERO),
        s = this.node_guide1.convertToNodeSpaceAR(r);
    this.node_guide2.setPosition(s), this.node_guide1.setContentSize(t.getContentSize()), this.node_guide2.setContentSize(e.getContentSize());
    var l = i.convertToWorldSpaceAR(cc.Vec2.ZERO),
        c = this.node.convertToNodeSpaceAR(l);
    this.handMove(a, c);
  }, e.prototype.handShake = function (t) {
    this.node_hand.stopAllActions(), this.node_hand.position = t;
    var e = cc.tween().by(.5, {
      y: 20
    }, {
      easing: "sineIn"
    }),
        o = cc.tween().by(.5, {
      y: -20
    }, {
      easing: "sineOut"
    }),
        i = cc.tween().sequence(e, o);
    cc.tween(this.node_hand).repeatForever(i).start();
  }, e.prototype.handMove = function (t, e) {
    var o = this;
    this.node_hand.stopAllActions(), this.node_hand.setPosition(t);
    var i = cc.v3(t.x, e.y);
    cc.tween(this.node_hand).to(.3, {
      position: i
    }).to(1, {
      position: e
    }).delay(.5).call(function () {
      o.handMove(t, e);
    }).start();
  }, e.prototype.resetSize = function () {
    this.node_guide1.width = this.node_guide1.height = 0, this.node_guide2.width = this.node_guide2.height = 0, this.node_hand.active = !1;
  }, e.prototype.onBtnGuideFinish = function () {
    this.node.active = !1;
  }, e.prototype.hideGuide = function () {
    this.node.active = !1;
  }, a([d(cc.Node)], e.prototype, "node_guide1", void 0), a([d(cc.Node)], e.prototype, "node_guide2", void 0), a([d(cc.Node)], e.prototype, "node_hand", void 0), a([d(cc.Node)], e.prototype, "guideHint", void 0), a([d(cc.Node)], e.prototype, "btn", void 0), a([d(cc.Node)], e.prototype, "bg", void 0), a([c], e);
}(cc.Component);

o["default"] = h;

cc._RF.pop();